<?php

/**
 * Generated Model class.
 */
class Base_ProfilePeer extends Db_Peer implements ISingleton
{

    const ID = '`profile`.`id`';

    const PHOTO_ID = '`profile`.`photo_id`';

    const FIRST_NAME = '`profile`.`first_name`';

    const PASSWORD = '`profile`.`password`';

    const EMAIL = '`profile`.`email`';

    const MSISDN = '`profile`.`msisdn`';

    const FIO = '`profile`.`fio`';

    const GENDER = '`profile`.`gender`';

    const PHONE = '`profile`.`phone`';

    const ADDRESS = '`profile`.`address`';

    const NEWSLETTER = '`profile`.`newsletter`';

    const STATUS = '`profile`.`status`';

    protected $_name = 'profile';

    protected $_rowClass = 'ProfileRow';

    protected $_dependentTables = array(
        'BlogPeer',
        'CommentPeer',
        'FriendsPeer',
        'FriendsPeer',
        'NewsPeer',
        'NewsShortPeer',
        'PhotoPeer',
        'VideoPeer'
        );

    protected $_referenceMap = array('PhotoPhotoId' => array(
            'columns' => 'photo_id',
            'refTableClass' => 'PhotoPeer',
            'refColumns' => 'id'
            ));

    private static $_instance = null;

    protected $_metadata = array(
        'id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'id',
            'COLUMN_POSITION' => 1,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => true,
            'PRIMARY_POSITION' => 1,
            'IDENTITY' => true
            ),
        'photo_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'photo_id',
            'COLUMN_POSITION' => 2,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'first_name' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'first_name',
            'COLUMN_POSITION' => 3,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '64',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'password' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'password',
            'COLUMN_POSITION' => 4,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '128',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'email' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'email',
            'COLUMN_POSITION' => 5,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '50',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'msisdn' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'msisdn',
            'COLUMN_POSITION' => 6,
            'DATA_TYPE' => 'char',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => '16',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'fio' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'fio',
            'COLUMN_POSITION' => 7,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '128',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'gender' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'gender',
            'COLUMN_POSITION' => 8,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'phone' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'phone',
            'COLUMN_POSITION' => 9,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'address' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'address',
            'COLUMN_POSITION' => 10,
            'DATA_TYPE' => 'varchar',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => '128',
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'newsletter' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'newsletter',
            'COLUMN_POSITION' => 11,
            'DATA_TYPE' => 'tinyint',
            'DEFAULT' => null,
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'status' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'profile',
            'COLUMN_NAME' => 'status',
            'COLUMN_POSITION' => 12,
            'DATA_TYPE' => 'tinyint',
            'DEFAULT' => '0',
            'NULLABLE' => true,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            )
        );

    /**
     * @return ProfilePeer
     */
    public static function getInstance()
    {
        if (!self::$_instance) {
        	self::$_instance = new ProfilePeer();
        }
        return self::$_instance;
    }

    /**
     * @return Db_Rowset
     */
    public function findById($id)
    {
        $select = $this->select();
        $select->where('`id` = ?', $id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByPhotoId($photo_id)
    {
        $select = $this->select();
        $select->where('`photo_id` = ?', $photo_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByFirstName($first_name)
    {
        $select = $this->select();
        $select->where('`first_name` = ?', $first_name);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByPassword($password)
    {
        $select = $this->select();
        $select->where('`password` = ?', $password);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByEmail($email)
    {
        $select = $this->select();
        $select->where('`email` = ?', $email);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByMsisdn($msisdn)
    {
        $select = $this->select();
        $select->where('`msisdn` = ?', $msisdn);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByFio($fio)
    {
        $select = $this->select();
        $select->where('`fio` = ?', $fio);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByGender($gender)
    {
        $select = $this->select();
        $select->where('`gender` = ?', $gender);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByPhone($phone)
    {
        $select = $this->select();
        $select->where('`phone` = ?', $phone);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByAddress($address)
    {
        $select = $this->select();
        $select->where('`address` = ?', $address);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByNewsletter($newsletter)
    {
        $select = $this->select();
        $select->where('`newsletter` = ?', $newsletter);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByStatus($status)
    {
        $select = $this->select();
        $select->where('`status` = ?', $status);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }


}

